package com.zz.spring6.validator.two;



import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class TestUser {


    @Test
    public void validatorByUserOne(){
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ValidatorConfig.class);
        MyValidator1 myValidator1 = context.getBean(MyValidator1.class);
        User1 user = new User1();
        user.setName("lucy");
        boolean message = myValidator1.validatorByUserOne(user);
        System.out.println(message);
    }
    @Test
    public void validatorByUserTwo(){
        ApplicationContext context =
                new AnnotationConfigApplicationContext(ValidatorConfig.class);
        MyValidator2 myValidator2 = context.getBean(MyValidator2.class);
        User1 user = new User1();
        user.setName("lucy");
        user.setAge(20);
        user.setMessage("test a t");
        boolean message = myValidator2.validatorByUserTwo(user);
        System.out.println(message);
    }
}
